<template>
  <div class="myDiv">
    <!-- 军队离休退休干部和退休士官 -->
    <el-card class="box-card secordCard" shadow="never">
      <div slot="header" class="clearfix">
        <span>军队离休退休干部和退休士官信息</span>
        <!-- <el-button style="float: right; padding: 3px 0" type="text">收起</el-button> -->
      </div>
      <div>
        <el-form ref="form" :model="form" :rules="rules" class="formWidth" label-width="140px">
        <el-row :gutter="10">
          <el-col :span="8">
            <el-form-item label="军休类别" prop="retireType">
              <el-select v-model="form.retireType" placeholder="请选择军休类别">
                <el-option
                  v-for="dict in retireTypeOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="parseInt(dict.dictValue)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
             <el-form-item label="入伍时间" prop="enlistedDate">
              <el-date-picker clearable size="small"
                v-model="form.enlistedDate"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="选择入伍时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="离休退休时间" prop="retirementDate">
              <el-date-picker clearable size="small"
                v-model="form.retirementDate"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="选择离休退休时间">
              </el-date-picker>
            </el-form-item>
           </el-col>
           <el-col :span="8">
            <el-form-item label="离休退休证件号码" prop="retirementCertificateCode">
              <el-input v-model="form.retirementCertificateCode" placeholder="请输入离休退休证件号码" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="安置日期" prop="arrangeDate">
              <el-date-picker clearable size="small"
                v-model="form.arrangeDate"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="选择安置日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="安置地" prop="arrangePlace">
              <el-input v-model="form.arrangePlace" placeholder="请输入安置地 省市县/区" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
             <el-form-item label="安置单位名称" prop="arrangeUnit">
              <el-input v-model="form.arrangeUnit" placeholder="请输入安置单位名称" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="安置单位性质" prop="arrangeUnitType">
              <el-input v-model="form.arrangeUnitType" placeholder="请输入安置单位性质" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="服务管理机构名称" prop="organizationName">
              <el-input v-model="form.organizationName" placeholder="请输入服务管理机构名称" />
            </el-form-item>
          </el-col>
        </el-row>
       </el-form>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  name: "retiredCadreCard",
  data(){
    return {
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        // soldierId: [
        //   { required: true, message: "关联soldier_base_info不能为空", trigger: "blur" }
        // ],
        retireType: [
          { required: true, message: "军休类别不能为空", trigger: "change" }
        ],
        enlistedDate: [
          { required: true, message: "入伍时间不能为空", trigger: "blur" }
        ],
        retirementDate: [
          { required: true, message: "离休退休时间不能为空", trigger: "blur" }
        ],
      },
      // 军休类别字典
      retireTypeOptions: [],
    }
  },
  props:{
    soldierId: String,
  },
  mounted(){
    this.form.soldierId = this.soldierId
  },
  created() {
    this.getDicts("retire_type").then(response => {
      this.retireTypeOptions = response.data;
    });
  },
  methods:{
     validateForm(){
      return new Promise((resolve , reject) => {
        this.$refs.form.validate(valid => {
          if (valid) {
            resolve();
          } else reject();
        });
      })
     }
  },
}
</script>
<style lang="scss" scoped>
.box-card{
  margin-bottom: 16px;
}
::v-deep .secordCard .el-form-item__content {
   height: 36px;
}
</style>